package com.lzh.chatnote.chat.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * Description: 幂等类型
 */
@AllArgsConstructor
@Getter
public enum RoomActiveTypeEnum {
    //是否全员展示 0否 1是 是否是热点群
    NORMAL_ROOM(0 ,"非热点群聊"),
    HOT_ROOM(1, "热点群聊聊");

    private final Integer type;
    private final String desc;

    private static Map<Integer, RoomActiveTypeEnum> cache;

    static {
        cache = Arrays.stream(RoomActiveTypeEnum.values()).collect(Collectors.toMap(RoomActiveTypeEnum::getType, Function.identity()));
    }

    public static RoomActiveTypeEnum of(Integer type) {
        return cache.get(type);
    }
}
